﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLKhachSan.DTO;
using System.Data;
using System.Data.SqlClient;

namespace QLKhachSan.DAO
{
    public class DAO_CTPhieuDatPhong
    {
        public static void themCTPhieuDatPhong(DTO_CTPhieuDatPhong p)
        {
            string[] name = new string[3] { "@MaPhieuDat", "@TenPhong", "@NgayTra" };
            object[] ob = new object[3] { p.MaPhieuDat,p.TenPhong,p.NgayTra };
            clsKetNoi.ThucThiLenhCoTS("pr_ThemCTPhieuDat", name, ob, 3);
        }
        public static DataTable hienthiDanhSachCTPhieuDatPhong()
        {
            return clsKetNoi.Load("pr_HienThiCTPhieuDatPhong");
        }
        public static void suaCTPhieuDatPhong(DTO_CTPhieuDatPhong p)
        {
            string[] name = new string[4] { "MaCTPhieuDat","@MaPhieuDat", "@TenPhong", "@NgayTra" };
            object[] ob = new object[4] { p.MaCTPhieuDat,p.MaPhieuDat, p.TenPhong, p.NgayTra };
            clsKetNoi.ThucThiLenhCoTS("pr_SuaCTPhieuDat", name, ob, 4);
        }
        public static void xoaCTPhieuDatPhong(DTO_CTPhieuDatPhong p)
        {
            string[] name = new string[1] { "@MaCTPhieuDat" };
            object[] ob = new object[1] { p.MaCTPhieuDat};
            clsKetNoi.ThucThiLenhCoTS("pr_XoaCTPhieuDat", name, ob, 1);
        }
        public static DataTable hienthiDanhSachCTPhieuDatSapHetHan()
        {
            string[] name = new string[3] { "@Ngay", "@Thang", "@Nam" };

            object[] ob = new object[3] { DateTime.Now.AddDays(1).Day, DateTime.Now.AddDays(1).Month, DateTime.Now.AddDays(1).Year };

            return clsKetNoi.LoadCoTS("pr_HienThiCTPhieuDatSapHetHan", name, ob, 3);
        }
        public static DataTable hienthiDanhSachCTPhieuDatXuLyQuaHan()
        {
            return clsKetNoi.Load("pr_HienThiCTPhieuDatXuLyQuaHan");
        }        
        public static DataTable hienthiDanhSachCTPhieuDatPhongTheoMaPhieuDat(DTO_CTPhieuDatPhong p)
        {
            string[] name = new string[1] { "@MaPhieuDat" };
            object[] ob = new object[1] { p.MaPhieuDat };
            return clsKetNoi.LoadCoTS("pr_HienThiPhieuDenTheoMaPhieuDat", name, ob, 1);
        }        
        public static DataTable hienthiDanhSachCTPhieuDatBaoCao()
        {
            return clsKetNoi.Load("pr_HienThiCTPhieuDatThongKe");
        } 


    }
}
